From: Giovanni Campagna Date: Sun, 2 Sep 2012 12:48:08 +0000 (+0200) Subject: ScreenShield: Allow lifting up the curtain with the mouse wheel X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5972 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=f177bd0b51a5129f55133134b69e774725fffd71;p=gnome-shell.git ScreenShield: Allow lifting up the curtain with the mouse wheel On a traditional mouse, or with edge-scrolling on a touchpad, it just feels natural to unlock by scrolling up. https://bugzilla.gnome.org/show_bug.cgi?id=683164 --- diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index ad8ecaed4..fd096c935 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -355,6 +355,8 @@ const ScreenShield = new Lang.Class({ }); this._lockScreenGroup.connect('key-release-event', Lang.bind(this, this._onLockScreenKeyRelease)); + this._lockScreenGroup.connect('scroll-event', + Lang.bind(this, this._onLockScreenScroll)); this._lockScreenContents = new St.Widget({ layout_manager: new Clutter.BinLayout(), name: 'lockScreenContents' }); @@ -439,6 +441,27 @@ const ScreenShield = new Lang.Class({ return true; }, + _onLockScreenScroll: function(actor, event) { + if (this._lockScreenState != MessageTray.State.SHOWN) + return false; + + let delta = 0; + if (event.get_scroll_direction() == Clutter.ScrollDirection.UP) + delta = 5; + else if (event.get_scroll_direction() == Clutter.ScrollDirection.SMOOTH) + delta = Math.max(0, event.get_scroll_delta()[0]); + + this._lockScreenScrollCounter += delta; + + // 7 standard scrolls to lift up + if (this._lockScreenScrollCounter > 35) { + this._ensureUnlockDialog(); + this._hideLockScreen(0); + } + + return true; + }, + _animateArrows: function() { let arrows = this._arrowContainer.get_children(); let unitaryDelay = ARROW_ANIMATION_TIME / (arrows.length + 1); @@ -656,6 +679,7 @@ const ScreenShield = new Lang.Class({ this._lockScreenState = MessageTray.State.SHOWN; this._lockScreenGroup.fixed_position_set = false; + this._lockScreenScrollCounter = 0; this.emit('lock-screen-shown'); },